<?php

namespace addon\lian\model\sqlmodel;

use think\Model;


class LianChangeModel extends Model
{
    protected $name = 'lian_change';

    protected $pk = 'id';

    public function lianLevel()
    {
        return $this->hasOne(LianLevelModel::class, 'level_id', 'level_id');
    }

    //新链动上级
    public function newLianParent()
    {
        return $this->hasOne(MemberModel::class, 'member_id', 'new_lian_pid');
    }

    //链动上级
    public function lianParent()
    {
        return $this->hasOne(MemberModel::class, 'member_id', 'lian_pid');
    }

    //直推上级
    public function parentMember()
    {
        return $this->hasOne(MemberModel::class, 'member_id', 'pid');
    }

    //链动会员
    public function lianMember()
    {
        return $this->hasOne(MemberModel::class, 'member_id', 'member_id');
    }
}